<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      position: relative;
      height: 100px;
      background: #161;
    }

    span {
      position: absolute;
      height: 20px;
      background: #000;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -10px);
    }
  </style>
</head>

<body>
  <div>
    <span>子绝父相</span>
  </div>
</body>

</html>